package com.mg.order.pojo.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mg.common.pojo.auto.generate.OrderDetail;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.beans.factory.annotation.Autowired;

import javax.validation.constraints.Min;

@Data
public class OrderDetailDto  {

    /**
     * 订单详情id
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 订单id
     */
    @JsonIgnore
    private Long orderId;

    /**
     * sku商品id
     */
    @Length(min = 3)
    private Long skuId;

    /**
     * 购买数量
     */
    @Min(value = 1)
    private Integer num;

    /**
     * 商品标题
     */
    @JsonIgnore
    private String title;

    /**
     * 商品动态属性键值集
     */
    @JsonIgnore
    private String ownSpec;

    /**
     * 价格,单位：分
     */
    @JsonIgnore
    private Long price;

    /**
     * 商品图片
     */
    @JsonIgnore
    private String image;

    public OrderDetailDto(@Length(min = 3) Long skuId, @Min(value = 1) Integer num) {
        this.skuId = skuId;
        this.num = num;
    }

    public OrderDetailDto() {
    }
}
